Skip to content

Fix material i18n fallback and published-project polish#39

Merged
pablojimeno merged 1 commit into
mainfrom
pablojimeno/published-page-fixes
May 8, 2026
Merged

Fix material i18n fallback and published-project polish#39
pablojimeno merged 1 commit into
mainfrom
pablojimeno/published-page-fixes

Conversation

@pablojimeno
Copy link
Copy Markdown
Member

Summary

Pilot-feedback bug fixes spanning two surfaces.

Materials — When a facilitator edited a material in English, viewers in
es/it/el saw the prose sections disappear entirely (heading and all),
because the form persisted blank strings into the other locale slots and
materials_helper#material_prose used || which doesn't fall through
truthy empty strings. Fixes:

  • material_prose and material_meta_description use .presence so empty
    / whitespace-only locale slots fall through to the English value.
  • The Translatable concern now drops blank locale slots before validation
    for every translation column on every model that uses the concern, so the
    JSONB column never accumulates { "es" => "" } noise from forms again.

Published project page (/published/:slug) — three cosmetic regressions:

  • The challenge was a tiny C6-style pill. Now renders the shared
    challenges/_card.html.erb partial, which gained a mode: local. In the
    new :public mode the question links to the challenges index (no Turbo
    preview drawer) and the bookmark + curator-edit affordances are hidden.
  • Inline images uploaded via Trix could overflow the column and lacked
    caption styling. Added scoped CSS for .trix-content figure.attachment
    that clamps the image to the container width and restores figure margins.
  • Removed the redundant prose prose-stone max-w-none wrapper around
    process_summary. ActionText already wraps its output in
    <div class="trix-content">, and the existing .trix-content > * + *
    rule provides paragraph spacing without conflicting with prose.

Spec lives at .munkit/specs/2026-05-08-post-pilot-fixes/.

Test plan

  • bin/rails test (734 runs, 0 failures)
  • bundle exec rubocop (clean)
  • Manually verify on staging: open a material in Spanish that was last
    edited in English, confirm sections render with English fallback content
    (heading + body)
  • Manually verify on staging: open /published/<slug> for a project
    with a challenge — challenge card renders, click goes to /challenges,
    no bookmark icon, inline images sit inside the column, multi-paragraph
    summary has visual spacing between paragraphs

Pilot users surfaced two regressions:

- Materials viewed in `es`/`it`/`el` showed empty sections after a
  facilitator edited the entry in `en`, because the form persisted blank
  strings into other locale slots and the read helper's `||` did not fall
  through truthy empty strings. Read side now uses `.presence`; the
  Translatable concern compacts blank slots from every translation column
  before validation, fixing the same latent issue across all models that
  use it.
- The published-project page rendered the challenge as a small "C6" pill,
  user-uploaded inline images could overflow the column, and Trix's
  `<div>`-as-paragraph markup combined with a redundant `prose` wrapper
  produced inconsistent spacing. The challenge now renders as the shared
  challenge card in a new `:public` mode (links to the challenges index,
  hides bookmark and curator-edit affordances). Inline image figures are
  clamped to container width with restored caption styling, and the
  redundant `prose` wrapper around `process_summary` is gone in favour of
  the existing `.trix-content` rules.

Spec: `.munkit/specs/2026-05-08-post-pilot-fixes/`.
@pablojimeno pablojimeno merged commit 78d7e48 into main May 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant